package com.onlinelearn.base.exception;

import lombok.Data;

@Data
public class OnlineLearnException extends RuntimeException{

    private static final long serialVersionUID = 5565760508056698922L;

    private String errMessage;

    private String errCode;

    public OnlineLearnException(){
        super();
    };

    public OnlineLearnException(String errMessage){
        super(errMessage);
        this.errMessage = errMessage;
    }
    public OnlineLearnException(String errMessage,String errCode){
        super(errMessage);
        this.errCode = errCode;
        this.errMessage = errMessage;
    }


    public static void cast(CommonError commonError){
        throw new OnlineLearnException(commonError.getErrMessage());
    }

    public static void cast(String errMessage){
        throw new OnlineLearnException(errMessage);
    }
}
